home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
ELECTRON
/
3861.ZIP
/
OTHER
/
STRAXGEN.C
< prev
next >
Wrap
C/C++ Source or Header
|
1993-10-01
|
2KB
|
86 lines
/*
* STRAXGEN (TM)
* STRAXGEN.C - ScopTrax modifier for generoc output.
* Copyright (c) August 1993, Chris S. Craig
*
* UNDER NO CIRCUMSTANCES SHOULD THE MODIFIED
* SCOPTRAX.EXE FILE BE DISTRIBUTED. ONLY THE
* ORIGINAL SCOPTRAX.ZIP FILE MAY BE DISTRIBUTED.
*
* This code may be freely distriubuted provided that the
* copyright notice is not removed and users are presented
* with the above message.
*
* Donation greatly appreciated (see SCOPTRAX.DOC for more
* info.)
*
* Use sound device "DAC on LPT1" in ScopTrax
*/
#include <stdio.h>
#define PORT 5
#define OFFSET 65968L
char NewCode[]=
{
/*
* The 2 zerows at the end of the first line will be replaced
* by the actual port to be used.
*/
0x2E, 0xC7, 0x06, 0x30, 0, 0, 0, /* mov word ptr cs:[0030],0 */
0x31, 0xC0, /* xor ax,ax */
0xCB /* retf */
};
int main( int argc, char **argv )
{
int port = 0;
FILE *fp;
puts(
"This program modifies SCOPTRAX.EXE version 1.0 so that\n"
"output will be sent to any port.\n"
"Copyright (c) 1993 Chris S. Craig\n\n"
"UNDER NO CIRCUMSTANCES SHOULD THE MODIFIED\n"
"SCOPTRAX.EXE FILE BE DISTRIBUTED. ONLY THE\n"
"ORIGINAL SCOPTRAX.ZIP FILE MAY BE DISTRIBUTED.\n");
if ( argc < 2 )
{
printf(
"Usage: %s <port>\n"
"\t\twhere <port> is the port address (in hex)",
argv[0] );
return 1;
}
/* Convert the ascii port the an integer */
sscanf( argv[1], "%x", &port);
if ( port == 0 )
{
printf( "Port error.\n" );
return 2;
}
printf( "Output will be sent to port %xH for 'DAC on LPT1'.\n", port );
*((int *) (NewCode + PORT)) = port;
fp = fopen( "SCOPTRAX.EXE", "rb+" );
if ( fp == NULL )
{
puts ( "SCOPTRAX.EXE muxt be in the current directory.");
return 3;
}
fseek( fp, OFFSET, SEEK_SET );
fwrite( &NewCode, sizeof NewCode, 1, fp );
fclose(fp);
return 0;
}